package org.jeecg.controller;

import org.jeecg.domain.ServeType;
import org.jeecg.domain.dto.FindDto;
import org.jeecg.service.ServeItemService;
import org.jeecg.service.ServeTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.jeecg.util.ResponseResult;

import java.util.List;

@RestController
@RequestMapping("/item")
@CrossOrigin
public class ItemController {
    @Autowired
    private ServeItemService itemService;
    @Autowired
    private ServeTypeService typeService;
    @PostMapping("/findAll")
    public ResponseResult findAll(FindDto findDto){
        return itemService.findAll(findDto);
    }
    @GetMapping("/findAllType")
    public ResponseResult findAllType(){
        List<ServeType> list = typeService.list();
        return ResponseResult.okResult(list);
    }
    @PostMapping("/qi")
    public ResponseResult qi(@RequestParam("id") String id){
        return itemService.qi(id);
    }
    @PostMapping("/jin")
    public ResponseResult jin(@RequestParam("id") String id){
        return itemService.jin(id);
    } @PostMapping("/deleteItem")
    public ResponseResult deleteItem(@RequestParam("id") String id){
        return itemService.deleteItem(id);
    }
//    @PostMapping("/add")
//    public ResponseResult add(@RequestBody AddDto addDto){
//        return itemService.add(addDto);
//    }
}
